package com.ch.home.testMapper;

import com.ch.home.bean.DishHistory;
import com.ch.home.mapper.restDishMapper.DishHistoryMapper;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

import java.util.LinkedList;

/**
 * Created by CHEN on 2019/8/28.
 */
@RunWith(SpringRunner.class)
@SpringBootTest
public class testDishHistoryMapper {

//    LinkedList<DishHistory> getDishHistory(DishHistory dishHistory);
//    LinkedList<DishHistory> getDishHistoryAndSource(DishHistory DishHistory);
//    int addDishHistory(DishCustom DishHistory);
//    int updateDishHistory(DishHistory DishHistory);

    @Autowired
    DishHistoryMapper dishHistoryMapper;


    @Test
    public void testGetDishHistory(){

        LinkedList<DishHistory> dishHistory = dishHistoryMapper.getDishHistory(new DishHistory(null, 1, null, null, null, null, null));
        System.out.println(dishHistory );

    }

    @Test
    public void testGetDishHistoryAndSource(){

        LinkedList<DishHistory> dishHistory = dishHistoryMapper.getDishHistoryAndSource(new DishHistory(null, 1, null, null, null, null, null));
        System.out.println(dishHistory );

    }




    @Test
    public void testAddDishHistory(){
        DishHistory dishHistory = new DishHistory(null, 2, "2001年由椰子身重剧毒，走投无路之下遇到了奶糖，奶糖拿出这普通的杭州哦酱鸭准备送行，不曾想却意外解毒成功", "2002年的第一场雪", 1, null, null);
        DishHistory dishHistory2 = new DishHistory(null, 2, "2001年由椰子身重剧毒，走投无路之下遇到了奶糖，奶糖拿出这普通的杭州哦酱鸭准备送行，不曾想却意外解毒成功", "2002年的第一场雪", 2, null, null);
        DishHistory dishHistory3 = new DishHistory(null, 2, "2001年由椰子身重剧毒，走投无路之下遇到了奶糖，奶糖拿出这普通的杭州哦酱鸭准备送行，不曾想却意外解毒成功", "2002年的第一场雪", 3, null, null);
        DishHistory dishHistory4 = new DishHistory(null, 2, "2001年由椰子身重剧毒，走投无路之下遇到了奶糖，奶糖拿出这普通的杭州哦酱鸭准备送行，不曾想却意外解毒成功", "2002年的第一场雪", 4, null, null);



        int i = dishHistoryMapper.addDishHistory(dishHistory);
        int i2 = dishHistoryMapper.addDishHistory(dishHistory2);
        int i3 = dishHistoryMapper.addDishHistory(dishHistory3);
        int i4 = dishHistoryMapper.addDishHistory(dishHistory4);

        System.out.println(i );
        System.out.println("------------------------------" );
        System.out.println("------------------------------" );
        System.out.println("------------------------------" );
        System.out.println("------------------------------" );
        System.out.println(dishHistory );
        System.out.println(dishHistory2 );
        System.out.println(dishHistory3 );
        System.out.println(dishHistory4 );

    }

    @Test
    public void testUpdateDishHistory(){
        DishHistory dishHistory = new DishHistory(4, 2, "走投无路之下遇到了奶糖，奶糖拿出这普通的杭州哦酱鸭准备送行，不曾想却意外解毒成功", "2002年的第二场雪", 1, null, null);
        DishHistory dishHistory2 = new DishHistory(5, 2, "2001年由椰子身重剧毒，不曾想却意外解毒成功", "2002年的第N场雪", 2, null, null);
        DishHistory dishHistory3 = new DishHistory(6, 2, "2001年由椰子身重剧毒，走投无路之下遇到了奶糖，不曾想却意外解毒成功", "2002年的第Ⅱ场雪", 3, null, null);
        DishHistory dishHistory4 = new DishHistory(7, 2, "2001年由椰子身重剧毒，奶糖拿出这普通的杭州哦酱鸭准备送行，不曾想却意外解毒成功", "2002年的第三场雪", 4, null, null);



        int i = dishHistoryMapper.updateDishHistory(dishHistory);
        int i2 = dishHistoryMapper.updateDishHistory(dishHistory2);
        int i3 = dishHistoryMapper.updateDishHistory(dishHistory3);
        int i4 = dishHistoryMapper.updateDishHistory(dishHistory4);

        System.out.println("------------------------------" );
        System.out.println("------------------------------" );
        System.out.println("------------------------------" );
        System.out.println("------------------------------" );
        System.out.println(dishHistory );
        System.out.println(dishHistory2 );
        System.out.println(dishHistory3 );
        System.out.println(dishHistory4 );

    }








}
